<template>
  <div id="app">
    <div class="echart-wrap">
      <echart-pie :series-data="dataList" :extra-option="extraOption" />
      <echart-pie :series-data="dataList" :extra-option="extraOption" />
    </div>
    <div class="echart-wrap">
      <echart-bar
        :x-axis-data="barList.xAxisData"
        :series-data="barList.seriesData"
        :extra-option="extraOption"
      />
      <echart-bar
        :x-axis-data="barList.xAxisData"
        :series-data="barList.seriesData"
        :extra-option="extraOption"
      />
    </div>
  </div>
</template>

<script>
import EchartPie from "@/components/Pie";
import EchartBar from "@/components/Bar";
export default {
  name: "App",
  components: {
    EchartPie,
    EchartBar,
  },
  data() {
    return {
      barList: {
        xAxisData: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
        seriesData: [
          {
            name: "Direct",
            type: "bar",
            stack: "total",
            label: {
              show: true,
            },
            emphasis: {
              focus: "series",
            },
            data: [320, 302, 301, 334, 390, 330, 320],
          },
          {
            name: "Mail Ad",
            type: "bar",
            stack: "total",
            label: {
              show: true,
            },
            emphasis: {
              focus: "series",
            },
            data: [120, 132, 101, 134, 90, 230, 210],
          },
          {
            name: "Affiliate Ad",
            type: "bar",
            stack: "total",
            label: {
              show: true,
            },
            emphasis: {
              focus: "series",
            },
            data: [220, 182, 191, 234, 290, 330, 310],
          },
          {
            name: "Video Ad",
            type: "bar",
            stack: "total",
            label: {
              show: true,
            },
            emphasis: {
              focus: "series",
            },
            data: [150, 212, 201, 154, 190, 330, 410],
          },
          {
            name: "Search Engine",
            type: "bar",
            stack: "total",
            label: {
              show: true,
            },
            emphasis: {
              focus: "series",
            },
            data: [820, 832, 901, 934, 1290, 1330, 1320],
          },
        ],
      },
      dataList: [
        {
          name: "前端",
          value: 20,
        },
        {
          name: "后端",
          value: 13,
        },
        {
          name: "AI",
          value: 33,
        },
      ],
      extraOption: {
        color: ["#fe883a", "#2d90d1", "#f75981", "#90e2a9"],
      },
    };
  },
};
</script>

<style lang="less">
.echart-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 90vw;
  height: 90vh;
  margin: 20px auto;
}
</style>
